﻿<!--
******************************************************************************************************
//  NetworkTreeView.xaml
//
//  Copyright © 2014, Kevin D. Jones.  All Rights Reserved.
//
//  This file is licensed to you under the Eclipse Public License -v 1.0 (the "License"); you may
//  not use this file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://www.opensource.org/licenses/eclipse-1.0.php
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  **************************************************************************************************
//  02/01/2014 - Kevin D. Jones
//       Generated original version of source code.
//
//****************************************************************************************************
-->
<UserControl x:Class="StartingFromScratch.Views.NetworkTreeView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:viewModels="clr-namespace:StartingFromScratch.ViewModels"
             xmlns:commandBehaviors="clr-namespace:StartingFromScratch.Behaviors"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <DockPanel>
        <!-- SEARCH AREA -->
        <!--<StackPanel DockPanel.Dock="Bottom" HorizontalAlignment="Center" Margin="4" Orientation="Horizontal" >
            <TextBlock Text="Search for:" FontFamily="Segoe UI" FontSize="14" FontWeight="Light"/>
            <TextBox x:Name="searchTextBox" Margin="6,0" Text="{Binding SearchText}" Width="150" FontFamily="Segoe UI" FontSize="14" FontWeight="Light" />
            <Button Command="{Binding SearchCommand}" Content="_Find" Margin="10,0" Padding="8,0" FontFamily="Segoe UI" FontSize="14" FontWeight="Light"/>
        </StackPanel>-->

        <!-- NETWORK TREE -->
        <TreeView ItemsSource="{Binding FirstGeneration}" FontWeight="Light" SelectedValuePath="">
            <TreeView.ItemContainerStyle >
                <Style TargetType="{x:Type TreeViewItem}">
                    <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                    <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                    <Setter Property="FontFamily" Value="Segoe UI" />
                    <Setter Property="FontWeight" Value="Light" />
                    <Setter Property="FontSize" Value="14" />
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="FontWeight" Value="Bold" />
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </TreeView.ItemContainerStyle>

            <TreeView.ItemTemplate   >
                <HierarchicalDataTemplate ItemsSource="{Binding Children}" >
                    <TextBlock Text="{Binding Name}" commandBehaviors:MouseDoubleClickBehavior.DoubleClickCommand="{Binding Path=OnMouseDoubleClick}">
                        <TextBlock.ContextMenu>
                            <ContextMenu ItemsSource="{Binding ContextMenuItems}" />
                        </TextBlock.ContextMenu>
                    </TextBlock>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
    </DockPanel>
</UserControl>
